<include file="Public/min-header" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 审核提现</h3>
                </div>
                <div class="panel-body ">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">申请信息</a></li>
                    </ul>
                    <form method="post" id="editForm">
                        <div class="tab-content">                 	  
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td class = "text-right">用户id</td>
                                            <td>
                                                <a href="{:U('Admin/user/detail',array('id'=>$cash[user_id]))}">{$cash[user_id]}</a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "text-right">用户名</td>
                                            <td>
                                                {$cash.nickname|default="空"}
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "text-right">用户平台余额</td>
                                            <td>
                                                {$user.user_money}
                                            </td>
                                        </tr>                               
                                        <tr>
                                            <td class = "text-right">申请提现金额</td>
                                            <td>
                                                {$cash.money}
                                            </td>
                                        </tr>                                       
                                        <tr>
                                            <td class = "text-right">申请提现银行</td>
                                            <td>
                                                {$cash.bank_name}                                        
                                            </td>
                                        </tr>                                
                                        <tr>
                                            <td class = "text-right">银行账号</td>
                                            <td>
                                                {$cash.account_bank}
                                            </td>
                                        </tr> 
                                        <tr>
                                            <td class = "text-right">银行账户名</td>
                                            <td>
                                                {$cash.account_name}                                        
                                            </td>
                                        </tr>                                
                                        <tr>
                                            <td class = "text-right">申请时间</td>
                                            <td>
                                                {$cash.create_time|date="Y-m-d H:i",###}
                                            </td>
                                        </tr>  
                                        <tr>
                                            <td class = "text-right">状态</td>
                                            <td>
                                    <if condition="$cash[status] eq 0">申请中</if>
                                    <if condition="$cash[status] eq 1">申请成功</if>
                                    <if condition="$cash[status] eq 2">申请失败</if>   
                                    </td>
                                    </tr>                                                                                   
                                    <tr>
                                        <td class = "text-right">备注</td>
                                        <td>
                                            <textarea rows="4" cols="60" id="remark" name="remark" class = "form-control">{$cash.remark}</textarea>
                                            <span id="err_remark" style="color:#F00; display:none;"></span>                                        
                                        </td>
                                    </tr> 
                                    <tr>
                                        <td class = "text-right">提现流程:</td>
                                        <td>
                                            1:用户前台申请提现<br/>
                                            2:管理员审核生产转账记录 ( 生成时自动扣除用户平台冻结金额 ) <br/>
                                            3:财务线下转账给用户<br/>
                                            或 2 , 3步可以调换,先转账后生成记录.<br/>
                                        </td>
                                    </tr>                                   
                                    </tbody>                                
                                </table>
                            </div>                           
                        </div>              
                        <div class="pull-right">
                            <input type="hidden" name="id" value="{$cash.id}">
                            <input type="hidden" name="user_id" value="{$cash.user_id}">
                            <input type="hidden" id="status" name="status" value="{$cash[status]}">
                            <if condition="in_array($cash[status],array(0))">
                                <button class="btn btn-primary" data-toggle="tooltip" type="button" onclick="passCash();">审核通过</button>
                            </if>                        
                            <if condition="$cash[status] eq 0">
                                <button class="btn btn-primary" data-toggle="tooltip" type="button" onclick="refuseCash();">审核不通过</button>
                            </if>
                            <if condition="$cash[status] eq 1">
                                <button class="btn btn-primary" data-toggle="tooltip" type='submit'>修改备注</button>
                            </if>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    // 确定提现
    function passCash() {
        if (!confirm("确定将从平台扣除用户冻结金额￥{$cash.money},确定吗?"))
            return false;

        if ($.trim($('#remark').val()).length == 0)
        {
            alert('请填写转账备注');
            return false;
        }
        $('#status').val('1');
        $('#editForm').submit();
    }
    // 拒绝提现    
    function refuseCash() {
        if (!confirm('确定要拒绝用户提现吗?'))
            return false;

        if ($.trim($('#remark').val()).length == 0)
        {
            alert('请填写拒绝备注');
            return false;
        }
        $('#status').val('2');
        $('#editForm').submit();
    }

</script>
</body>

</html>
